/**
 * 
 */
package mdb.com.vn.persist;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Repository;

import mdb.com.vn.model.Customer;

/**
 * @author tu.dod
 *
 */
@Repository("customerDAO")
public class CustomerDAOImpl extends AbstractHibernateDAOImpl<Customer, String> implements CustomerDAO, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected Class<Customer> getDomainClass() {
		// TODO Auto-generated method stub
		return Customer.class;
	}
	@SuppressWarnings("unchecked")
	@Override
	public Customer getCustomerInfo(String gcif) {
		// TODO Auto-generated method stub
		List<Customer> customers = getSession().getNamedQuery("Customer.findByGcif").setString("gcif", gcif).list();
		for (Customer customer : customers) {
			return customer;
		}
		return  null;
	}

}
